package com.sinosoft.tcmemr.control;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sinosoft.framework.core.common.utils.ajax.ResponseData;
import com.sinosoft.tcmemr.control.dto.PatientData;
import com.sinosoft.tcmemr.entity.PatientEntity;
import com.sinosoft.tcmemr.service.PatientService;

@Controller
@RequestMapping("patient")
public class PatientController {
	
	@Autowired
	private PatientService patientService;
	
	@RequestMapping(value = "/create", method = RequestMethod.POST)
	@ResponseBody
	public ResponseData createPatient(PatientData patientData) {
		///System.out.println("#method:"+ RequestMethod.GET);
		PatientEntity patientEntity;
		try {
			patientEntity = patientData.toPatientEntity();
			///this.patientService.insertSelective(patientEntity);
			return new ResponseData(true,patientEntity);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return new ResponseData(false,null,"保存失败!",null);
		}
		///return "tcmemr/createPatient";
	}
}
